Tables [dbo].[Content_File]
Properties
PropertyValue
Created10:31:18 AM Tuesday, March 02, 2010
Last Modified1:17:32 PM Thursday, February 23, 2012
Columns
NameData TypeMax Length (Bytes)Allow NullsIdentity
Cluster Primary Key PK_Content_File: ContentFileIDContentFileIDnumeric(18,0)9
No
1 - 1
Foreign Keys FK_Content_File_Content: [dbo].[Content].ContentIDIndexes ix_Content_File: ContentIDContentIDnumeric(18,0)9
No
Foreign Keys FK_ContentFile_FileType: [dbo].[File_Type_Ref].FileTypeCodeIndexes IX_Content_File_FileTypeCode: FileTypeCodeFileTypeCodevarchar(4)4
No
Descriptionvarchar(255)255
Yes
SourceLocationvarchar(255)255
Yes
PublishLocationvarchar(255)255
Yes
FileNamevarchar(255)255
Yes
SortOrdernumeric(18,0)9
Yes
Foreign Keys FK_Content_File_OriginalContentFileID: [dbo].[Content_File].OriginalContentFileIDIndexes ix_ContentFile_OriginalContentFileID: OriginalContentFileIDOriginalContentFileIDnumeric(18,0)9
Yes
Foreign Keys FK_Content_File_PreviousContentFileID: [dbo].[Content_File].PreviousContentFileIDIndexes ix_ContentFile_PreviousContentFileID: PreviousContentFileIDPreviousContentFileIDnumeric(18,0)9
Yes
Indexes Indexes
NameColumnsUnique
Cluster Primary Key PK_Content_File: ContentFileIDPK_Content_FileContentFileID
Yes
ix_Content_FileContentID
IX_Content_File_FileTypeCodeFileTypeCode
ix_ContentFile_OriginalContentFileIDOriginalContentFileID
ix_ContentFile_PreviousContentFileIDPreviousContentFileID
Triggers Triggers
NameANSI Nulls OnQuoted Identifier OnOn
asi_Content_File_Insert
Yes
Yes
After Insert
Foreign Keys Foreign Keys
NameColumns
FK_Content_File_ContentContentID->[dbo].[Content].[ContentID]
FK_Content_File_OriginalContentFileIDOriginalContentFileID->[dbo].[Content_File].[ContentFileID]
FK_Content_File_PreviousContentFileIDPreviousContentFileID->[dbo].[Content_File].[ContentFileID]
FK_ContentFile_FileTypeFileTypeCode->[dbo].[File_Type_Ref].[FileTypeCode]
Permissions
TypeActionOwning Principal
GrantDeleteIMIS
GrantInsertIMIS
GrantReferencesIMIS
GrantSelectIMIS
GrantUpdateIMIS
SQL Script
CREATE TABLE [dbo].[Content_File]
(
[ContentFileID] [numeric] (18, 0) NOT NULL IDENTITY(1, 1),
[ContentID] [numeric] (18, 0) NOT NULL,
[FileTypeCode] [varchar] (4) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SourceLocation] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[PublishLocation] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[FileName] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SortOrder] [numeric] (18, 0) NULL,
[OriginalContentFileID] [numeric] (18, 0) NULL,
[PreviousContentFileID] [numeric] (18, 0) NULL
) ON [PRIMARY]

GO
-- =============================================
-- This trigger sets OriginalContentFileID to the ID of the content file inserted.
-- =============================================
CREATE TRIGGER [dbo].[asi_Content_File_Insert]
    ON [dbo].[Content_File]
    FOR INSERT
AS
BEGIN
    UPDATE Content_File SET OriginalContentFileID = ContentFileID
    WHERE ContentFileID IN (SELECT ContentFileID FROM inserted
                            WHERE OriginalContentFileID IS NULL)
END

GO
ALTER TABLE [dbo].[Content_File] ADD CONSTRAINT [PK_Content_File] PRIMARY KEY CLUSTERED ([ContentFileID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ix_Content_File] ON [dbo].[Content_File] ([ContentID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Content_File_FileTypeCode] ON [dbo].[Content_File] ([FileTypeCode]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ix_ContentFile_OriginalContentFileID] ON [dbo].[Content_File] ([OriginalContentFileID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ix_ContentFile_PreviousContentFileID] ON [dbo].[Content_File] ([PreviousContentFileID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Content_File] ADD CONSTRAINT [FK_Content_File_Content] FOREIGN KEY ([ContentID]) REFERENCES [dbo].[Content] ([ContentID])
GO
ALTER TABLE [dbo].[Content_File] ADD CONSTRAINT [FK_Content_File_OriginalContentFileID] FOREIGN KEY ([OriginalContentFileID]) REFERENCES [dbo].[Content_File] ([ContentFileID])
GO
ALTER TABLE [dbo].[Content_File] ADD CONSTRAINT [FK_Content_File_PreviousContentFileID] FOREIGN KEY ([PreviousContentFileID]) REFERENCES [dbo].[Content_File] ([ContentFileID])
GO
ALTER TABLE [dbo].[Content_File] ADD CONSTRAINT [FK_ContentFile_FileType] FOREIGN KEY ([FileTypeCode]) REFERENCES [dbo].[File_Type_Ref] ([FileTypeCode])
GO
GRANT REFERENCES ON  [dbo].[Content_File] TO [IMIS]
GRANT SELECT ON  [dbo].[Content_File] TO [IMIS]
GRANT INSERT ON  [dbo].[Content_File] TO [IMIS]
GRANT DELETE ON  [dbo].[Content_File] TO [IMIS]
GRANT UPDATE ON  [dbo].[Content_File] TO [IMIS]
GO
Uses
Used By